package com.lifetime.controller;

import com.drew.imaging.ImageProcessingException;
import com.lifetime.service.PicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.text.ParseException;


@RestController
public class FileController {
    @Autowired
    PicService picService;

    @RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
    public void fileUpload(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request) throws IOException, ImageProcessingException, ParseException {
        picService.setOnePic(file, request);
    }


}
